namespace EntityFrameworkStudy.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddCatalogAndBook : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Catalogs",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Books",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Body = c.String(),
                        CatalogId = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Catalogs", t => t.CatalogId)
                .Index(t => t.CatalogId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Books", new[] { "CatalogId" });
            DropForeignKey("dbo.Books", "CatalogId", "dbo.Catalogs");
            DropTable("dbo.Books");
            DropTable("dbo.Catalogs");
        }
    }
}
